package com.hou.rocketmq.config;


import io.swagger.annotations.Api;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@Configuration
@EnableSwagger2  //开启
public class SwaagerConfig {

    @Bean
    public Docket api() {
        //Docket根据组名区分
        return new Docket(DocumentationType.SWAGGER_2).groupName("v1").select()
                //指定API 包和路径
                .apis(RequestHandlerSelectors.withClassAnnotation(Api.class))
                .paths(PathSelectors.any()).build().apiInfo(apiInfo1());
    }

    private ApiInfo apiInfo1() {
        return new ApiInfoBuilder()
                .title("接口文档")
                //服务条款网址
                .termsOfServiceUrl("www.example.com")
                // 联系人
                .contact(new Contact("侯征","https://home.cnblogs.com/u/houzheng/","799827577@qq.com"))
                .version("v0.01")
                .build();
    }

}
